﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Web;
using elfam.web.Utils;

namespace elfam.web.Services
{
    public class MailService
    {
        public static void Send(string subject, string text, string email)
        {
            MailMessage message = new MailMessage(new MailAddress(Settings.Instance.MailFromAddress, Settings.Instance.MailFromDisplayName), new MailAddress(email));
            message.Subject = subject;
            message.Body = text;
            message.IsBodyHtml = true;
            message.BodyEncoding = Encoding.UTF8;
            SmtpClient client = new SmtpClient(Settings.Instance.MailSmtpServer, Settings.Instance.MailSmtpPort)
            {
                Credentials = new NetworkCredential() { UserName = Settings.Instance.MailUserName, Password = Settings.Instance.MailUserPassword }

            };
            client.Send(message);
        }
    }
}
